{
 "metadata": {
  "name": "",
  "signature": "sha256:cd9f5b672c86961f2fe931c3fa564d2773377f93b082d4852ed5339e7980c4dc"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The World Cup Problem: Germany v. Argentina\n",
      "-------------------------------------------\n",
      "\n",
      "Allen Downey\n",
      "\n",
      "This notebook contains a solution to a problem I posed in my Bayesian statistics class:\n",
      "\n",
      "> In the final match of the 2014 FIFA World Cup, Germany defeated Argentina 1-0.  How much evidence \n",
      "> does this victory provide that Germany had the better team?  What is the probability that Germany\n",
      "> would win a rematch?\n",
      "\n",
      "Scoring in games like soccer and hockey can be (reasonably) well modeled by a Poisson process, which assumes that each team, against a given opponent, will score goals at some goal-scoring rate, $\\lambda$, and that this rate is stationary; in other words, the probability of scoring a goal is about the same at any point during the game.\n",
      "\n",
      "Based on this modeling decision, we can answer the questions by\n",
      "\n",
      "1. Defining a prior distribution for each team's goal-scoring rate against the other,\n",
      "2. Updating the prior based on the outcome of the game,\n",
      "3. Using the posterior distributions to compute the probability that Germany's goal-scoring rate is higher.\n",
      "4. Generating a predictive distribution for the number of goals each team would score in a rematch.\n",
      "\n",
      "My solution uses the ThinkBayes2 framework, which is described in [Think Bayes](http://thinkbayes.com), and summarized in [this notebook](http://nbviewer.ipython.org/github/AllenDowney/ThinkBayes2/blob/master/code/framework.ipynb).\n",
      "\n",
      "I'll start with Step 2.\n",
      "\n",
      "### Step 2: Updating\n",
      "\n",
      "If goal-scoring is a Poisson process, the distribution of goals per game is Poisson with parameter $\\lambda$.  To compute the distribution of $\\lambda$ we can define a new class that inherits from `thinkbayes2.Suite` and provides an appropriate `Likelihood` function:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# first a little house-keeping\n",
      "from __future__ import print_function, division\n",
      "% matplotlib inline"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import thinkbayes2\n",
      "\n",
      "class Soccer(thinkbayes2.Suite):\n",
      "    \"\"\"Represents hypotheses about goal-scoring rates.\"\"\"\n",
      "\n",
      "    def Likelihood(self, data, hypo):\n",
      "        \"\"\"Computes the likelihood of the data under the hypothesis.\n",
      "\n",
      "        hypo: goal rate in goals per game\n",
      "        data: interarrival time in minutes\n",
      "        \"\"\"\n",
      "        goals = data\n",
      "        lam = hypo\n",
      "        like = thinkbayes2.EvalPoissonPmf(goals, lam)\n",
      "        return like"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "`Likelihood` computes the likelihood of `data` given `hypo`, where `data` is an observed number of goals, and `hypo` is a hypothetical goal-scoring rate in goals per game.  We can compute the likelihood of the data by evaluating the Poisson probability mass function (PMF).\n",
      "\n",
      "Now we can get back to Step 1.\n",
      "\n",
      "### Step 1: Constructing the prior\n",
      "\n",
      "Before the game starts, what should we believe about each team's goal scoring rate against each other?  We could use previous tournament results to construct the priors, but to keep things simple, I'll just use the average goal-scoring rate from all matches in the tournament, which was 2.67 goals per game (total for both teams).\n",
      "\n",
      "To construct the prior, I'll start with an unrealistic uniform distribution and update it with fake data until the mean matches the observed rate for a single team, 1.34 goals per game."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy\n",
      "import thinkplot\n",
      "\n",
      "hypos = numpy.linspace(0, 12, 201)\n",
      "suite = Soccer(hypos)\n",
      "suite.Update(0.33)                # fake data chosen by trial and error to yield the observed prior mean\n",
      "\n",
      "thinkplot.Pdf(suite)\n",
      "suite.Mean()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 3,
       "text": [
        "1.3395835151444653"
       ]
      },
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEACAY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A6RNzvoGowr\nAddOvwvhezRNEV2GcdXqZq9ijG/UYIw13kNkLVb1/333Ykyt/5Sm9uU3tkUnIiIiIiIiIiIiIiIi\nIiIiIiIiIiIiIiIiIiKd4/8BBwwzGzr9F3gAAAAASUVORK5CYII=\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fce00199a10>"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "According to this prior, the goal-scoring rates are always greater than zero, with the most likely value (a priori) near 0.5.  Goal scoring rates greater than 5 are considered unlikely.\n",
      "\n",
      "### Step 2: Comparing posteriors\n",
      "\n",
      "The next step is to compute the posteriors for the two teams:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "germany = suite.Copy(label='Germany')\n",
      "argentina = suite.Copy(label='Argentina')\n",
      "germany.Update(1)\n",
      "argentina.Update(0)\n",
      "\n",
      "print('posterior mean Germany', germany.Mean())\n",
      "print('posterior mean Argentina', argentina.Mean())"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "posterior mean Germany 1.16529110336\n",
        "posterior mean Argentina 0.677218426967\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "`Update` invokes the likelihood function for each hypothetical value of $\\lambda$ and updates the distribution accordingly.\n",
      "\n",
      "Since both teams scored fewer goals than the prior mean (1.4), we expect both posterior means to be lower.  Germany's posterior mean is 1.2; Argentina's is 0.7.  We can plot the posteriors:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "thinkplot.Pdf(germany)\n",
      "thinkplot.Pdf(argentina)\n",
      "thinkplot.Config(xlabel='goal-scoring rate', ylabel='probability')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEPCAYAAABcA4N7A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p\ntv8fKojNQ9Vyznm5bxEqgAlhiNQoRDDaAFyPajqJRn2Zg/qrvxxVAwD1pZmrbUcDxahMp9/D+YVs\n/yIuQPVvjEMFiRTUl+0bwB+04we14xO1e2JQX8pf4MzpfwkwANV/4uvCTG2opqCZOJuebsZYh3us\n9vlA1Rhs2na1Vk671cBCnH8kXoK5VuATfiA1ChGMtqKaXXahFpjZDVRq5+4EXkR9+R1FpYwG1fm9\nCbVM6SZU4ADPq5eNQnX6tgJNwA+1n3NRncsRqL/or0KlaH5BK0+zVoYmD89u0/1s732LgN+hOpvL\nUAGnysPvQX//X1ALXc1HrSdvXxFxJ6q2sgPV4f4cqolrGyqQnUatmSyEEKYTpf2MRP0VPjaAZelq\n9s8WggqINwSwLEIIEbTeQHXI7se5EplZ/C/Oz/ZsgMsihBBCCCGEEEIIIYQQQgghhBBCCCGEEEII\nIYQQZvL/AXZDPGlMfW16AAAAAElFTkSuQmCC\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fcde9d1e6d0>"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "To answer the first question, \"How much evidence does this victory provide that Germany had the better team?\", we can compute the posterior probability that Germany had a higher goal-scoring rate:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "post_prob = germany > argentina\n",
      "print('posterior prob Germany > Argentina', post_prob)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "posterior prob Germany > Argentina 0.704322830196\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Based on the prior distributions, we would have said that Germany had a 50% chance of having the better team, or 1:1 odds.  Based on the posteriors, we would say that Germany has a 70% chance.  We can use the ratio of the prior and posterior odds to compute the Bayes factor, which measures the strength of the evidence."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "prior_odds = 1\n",
      "post_odds = post_prob / (1 - post_prob)\n",
      "print('posterior odds Germany > Argentina', post_odds)   \n",
      "k = post_odds / prior_odds\n",
      "print('Bayes factor', k)   "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "posterior odds Germany > Argentina 2.38206700457\n",
        "Bayes factor 2.38206700457\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "The Bayes factor is 2.4, which is generally considered weak evidence.\n",
      "\n",
      "Now on to Step 4.\n",
      "\n",
      "### Step 4: The predictive distributions\n",
      "\n",
      "If we knew the actual goal scoring rate, $\\lambda$, we could predict how many goals each team work score in a rematch.  The distribution of goals would be Poisson with parameter $\\lambda t$.\n",
      "\n",
      "We don't actually know $\\lambda$, but we can use the posterior distribution of $\\lambda$ to generate a predictive distribution for the number of additional goals."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "def PredictiveDist(suite, duration=1, label='pred'):\n",
      "    \"\"\"Computes the distribution of goals scored in a game.\n",
      "\n",
      "    returns: new Pmf (mixture of Poissons)\n",
      "    \"\"\"\n",
      "    metapmf = thinkbayes2.Pmf()\n",
      "    for lam, prob in suite.Items():\n",
      "        pred = thinkbayes2.MakePoissonPmf(lam * duration, 15)\n",
      "        metapmf[pred] = prob\n",
      "\n",
      "    mix = thinkbayes2.MakeMixture(metapmf, label=label)\n",
      "    return mix\n",
      "\n",
      "germany_pred = PredictiveDist(germany, label='germany')\n",
      "argentina_pred = PredictiveDist(argentina, label='argentina')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 8
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "`PredictiveDist` takes the posterior distribution of $\\lambda$ and a duration (in units of games).\n",
      "\n",
      "It loops through the hypotheses in `suite`, computes the predictive distribution of goals for each hypothesis, and assembles a \"meta-Pmf\" which is a Pmf that maps from each predictive distribution to its probability.\n",
      "\n",
      "Finally, it uses `MakeMixture` to compute the mixture of the distributions.  Here's what the predictive distributions look like."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "thinkplot.Hist(germany_pred, width=0.45, align='right')\n",
      "thinkplot.Hist(argentina_pred, width=0.45, align='left')\n",
      "thinkplot.Config(xlabel='predicted # goals', ylabel='probability', xlim=[-0.5, 7])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEPCAYAAACk43iMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHQNJREFUeJzt3Xt4VeWd6PFvCAiogMEgKJeiQovUEbSKF6SmtnbgCFqY\nKleB0SqnilqxPaDWMRzntE570LbDGaVUi+BMsVjHWqtiOzReOipQbtKCAgpy8YKCCNgLkZw/3pVk\nE0Kygll7Z2d9P8+znqy191rv/iXK+u33st4XJEmSJEmSJEmSJEmSJEmSpAYZDKwF1gFTD3FOCbAc\nWA2UZSUqSVLiCoH1QE+gFbACOKXGOccAfwS6RcfF2QpOkgQtEix7ACEJbAT2AfOBS2ucMwb4BbAl\nOn4vwXgkSTUkmQS6ApszjrdEr2XqDXQEfgcsBa5IMB5JUg0tEyy7IsY5rYAzgC8CRwIvAi8R+hAk\nSQlLMglsBbpnHHenutmn0mZCE9Cfo+05oB81kkC/fv0qVq5cmVykktQ8bQB65erDW0YB9ASOoPaO\n4T7AbwmdyEcCrwB9aymrIgl33HFHIuUmyZiTl2/xVlTkX8z5Fm9FRX7GTIwWmSRrAuXAZGAh4SZ/\nP7AGmBS9P4swfPRpYBWwH5gN/CnBmCRJGZJMAgBPRVumWTWO/2+0SZKyLMnRQU1eSUlJrkNoMGNO\nXr7FC/kXc77FC/kZcxwFuQ4gpqh5S5IUV0FBAdRzn0+6OUhSM9SxY0d27tyZ6zAUKSoqYseOHYd1\nrTUBSQ1WUFCA/yabjkP994hTE0h1n4AkpV2qm4PuXr2+UcubcmrOnsmQpMNiTUCSUswkIEkplurm\nIEmNZ9qi1xIt/64LP51o+WllTUCSalFeXp7rELLCJCCp2Vm2bBmnn3467du35/LLL2fkyJHcfvvt\nADzxxBP079+foqIiBg4cyCuvvFJ1Xc+ePfne977HaaedRrt27diwYQMtWrRgzpw59OjRg2OPPZb7\n7ruPJUuWcNppp1FUVMT1119fdf2GDRu48MILKS4uplOnTowbN45du3YdUP6MGTPo168fxxxzDKNG\njeKvf/0rAKeeeipPPPFE1bn79u2juLiYpGdQNglIalb+9re/MXz4cK688kp27tzJ6NGjeeyxxygo\nKGD58uVcddVVzJ49mx07djBp0iQuueQS9u3bV3X9/Pnzeeqpp/jggw8oLCwEYPHixaxfv5758+dz\n44038p3vfIdFixbxxz/+kZ///Oc899xzVdffdtttvPXWW6xZs4bNmzdTWlpa9V5BQQELFixg4cKF\nvPHGG6xatYo5c+YAMGHCBB566KGqc5988km6du1Kv379Ev17mQQkNSsvvfQSH3/8Mddffz2FhYUM\nHz6cAQMGUFFRwezZs5k0aRJnnXUWBQUFjB8/ntatW/PSSy8B4SZ9ww030LVrV1q3bl1V5u23384R\nRxzBRRddRLt27RgzZgzFxcWccMIJDBo0iOXLlwNw8skn88UvfpFWrVpRXFzMTTfdxLPPPntAfDfc\ncANdunShqKiIYcOGsWLFCgDGjh3Lr3/9a/bs2QPAvHnzuOKK5BdbNAlIala2bdtG164HrmTbvXtY\n32rTpk3MmDGDoqKiqm3Lli1s27btoHMzde7cuWq/bdu2Bx1X3rjfeecdRo0aRbdu3ejQoQNXXHEF\n77///gFldenSpdZrTzjhBAYOHMgjjzzCBx98wNNPP83YsWMP988Qm0lAUrNy/PHHs3Xr1gNee/PN\nN4Fwg7/tttvYuXNn1bZnzx5GjhxZdW401UKDVF5z6623UlhYyOrVq9m1axfz5s1j//799V5XqbJJ\naMGCBZx33nkcf/zxDY6loUwCkpqV8847j8LCQmbOnEl5eTm//OUvWbJkCQUFBVx99dXcd999LF68\nmIqKCvbu3XtAE8zhyJyzZ8+ePRx11FG0b9+erVu38v3vfz/2tQDDhw9n2bJl/OhHP2L8+PGHHVND\n+JyApEbRVMbxt2rVikcffZSvfe1r3HLLLQwZMoShQ4fSunVrPve5zzF79mwmT57MunXraNu2LYMG\nDapzrYD6agaZ799xxx2MHz+eDh060Lt3b8aNG8cPfvCDOq/NvL5NmzaMGDGChx9+mBEjRsT/pT+B\nVM8i6txB0uHJt1lEzz77bK699lomTJiQ61Dqdeedd7Ju3Trmzp0b+xpnEZWkDM899xxvv/025eXl\nPPjgg6xevZrBgwfnOqx67dixgwceeIBrrrkma59pEpDU7Lz66qtVD4Tdc889PPLIIweM6GmKZs+e\nTY8ePRgyZAjnn39+1j7X5qBGZHOQ0iLfmoOaO5uDJEmHxSQgSSlmEpCkFDMJSFKKmQQkKcVMApKU\nJc8//zx9+vTJdRgHcNoISY2isYdc15SPQ7BbtGjB+vXrOemkkwAYNGgQa9euzXFUB0q6JjAYWAus\nA6bW8n4JsAtYHm3fTjgeSary8ccfJ/4ZTf15iiSTQCEwk5AI+gKjgVNqOe9Z4PRo++cE45GUEnfd\ndRe9evWiffv2fPazn+Wxxx4DYM6cOQwcOJApU6ZQXFzM9OnT2bFjB8OGDaNDhw4MGDCAb3/72wwa\nNKiqrLVr13LRRRdx7LHH0qdPHxYsWFD13sSJE7nuuusYOnQo7du355xzzuH1118H4POf/zwA/fr1\no127dixYsICysrID1iuoa7nJDz74gKFDh3LcccfRsWNHhg0bdtAU2Y0hySQwAFgPbAT2AfOBS2s5\nL1+eWpaUJ3r16sULL7zAhx9+yB133MG4ceN4++23gbBU5Mknn8y7777LrbfeyrXXXku7du145513\nePDBB5k7d27VzJ579+7loosuYty4cWzfvp358+dz7bXXsmbNmqrPevjhhyktLWXnzp306tWL2267\nDaBqyclVq1axe/duLrvssoPirGu5yf3793PVVVfx5ptv8uabb9K2bVsmT57c6H+rJJNAV2BzxvGW\n6LVMFcB5wErgSUKNQZI+ka9+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P9/cCHtZz35WhbTqhVfAboHcXzKPAXYDchydQ1\nlfNxhAWB+hFu6LUZSJhp9W+EKbcr+zHaE/oqno+OHyRMcQ1hrqPnozLHEv4eNa0i1CrGAh/XEaNS\nyiSgpiizTbugxvHejP3fEOalPx34LLUvUFLXzTnOHPzfzfiMT1O9ulTmtYcq515CzaI3IZH8PaFW\ncGMt51bELDPz9TmEPozTCDWEtrWcdzHw/whTHy8hrJYmVTEJqCnqQfVC3mOo/hac6WXCt+fKZp+j\nCDfbtYQmpZOi10cf4jP+i+qRQIWEb9y7OXDWxYWEdWUr+xq6EtrynwO+QnVz0FBq74z9OuHm/L+j\n839NSCY/rOXc3xNGL7UmNAddHL3+IaEWUVkbugIoi/aPJizj2QoYlxFDQcbPHtH50wg1isrfRQLC\nvPpSU/MqYcWpBwidmpXNNpk32u2ENv6fEW6cEDpr1wHXEG64HxESyFEZ11eWcSPwY+AqQjPJ/yQk\nlt8Tvr0/SehnOIXqpqndhJvtckKz1ErCyl6L6/hdLiCsqzCI6pt3bZYSmpVWEZa2fIXqdWwnAPcR\n5uLfQPU04rdHMW+Pfh5d4/csJHRKdyAkhB8SkookNVk9yZ+FcxpbZbI6ktB00z+HsSglrAmoKUrr\nOPcfEzp32xDa+1fkNBpJkiRJkiRJkiRJkiRJkiRJ+ej/A/OIHUm+x5IfAAAAAElFTkSuQmCC\n",
       "text": [
        "<matplotlib.figure.Figure at 0x7fcdd983fb10>"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Using the predictive distributions, we can compute probabilities for the outcomes of a rematch."
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "win = germany_pred > argentina_pred\n",
      "lose = germany_pred < argentina_pred\n",
      "tie = 1 - (win + lose)\n",
      "\n",
      "print('posterior prob Germany wins rematch', win)\n",
      "print('posterior prob Argentina wins rematch', lose)\n",
      "print('posterior prob tie', tie)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "posterior prob Germany wins rematch 0.450511695667\n",
        "posterior prob Argentina wins rematch 0.225540779355\n",
        "posterior prob tie 0.323947524978\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "If the score is tied after 90 minutes the teams play an additional 30 minute period.  We can use `PredictiveDist` again to compute the distribution of scores after 1/3 of a game:"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "germany_pred_overtime = PredictiveDist(germany, 1/3, label='germany')\n",
      "argentina_pred_overtime = PredictiveDist(argentina, 1/3, label='argentina')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 11
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "win = germany_pred_overtime > argentina_pred_overtime\n",
      "lose = germany_pred_overtime < argentina_pred_overtime\n",
      "tie = 1 - (win + lose)\n",
      "\n",
      "print('posterior prob Germany wins rematch', win)\n",
      "print('posterior prob Argentina wins rematch', lose)\n",
      "print('posterior prob tie', tie)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "posterior prob Germany wins rematch 0.256156067229\n",
        "posterior prob Argentina wins rematch 0.13931727161\n",
        "posterior prob tie 0.604526661162\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print('Total prob Germany wins a rematch', 0.45 + 0.32 * 0.26)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total prob Germany wins a rematch 0.5332\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print('Total prob Argentina wins', 0.23 + 0.32 * 0.14)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total prob Argentina wins 0.2748\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print('Prob of draw after overtime', 0.32 * 0.60)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Prob of draw after overtime 0.192\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}